package com.wingice.system.validator.dictionary;

import com.wingice.system.entity.SysDictionary;
import com.wingice.system.exception.SysBusinessCode;
import com.wingice.system.exception.SysBusinessException;
import com.wingice.system.validator.BaseValidator;
import org.springframework.util.StringUtils;

/**
 * @author 胡昊
 * Description:
 * Date: 2021/3/5
 * Time: 10:51
 * Mail: huhao9277@gmail.com
 */
public class SysDictionaryValidator extends BaseValidator {

    public static void insertValidate(SysDictionary sysDictionary) {
        if (StringUtils.isEmpty(sysDictionary.getDictionaryCode())) {
            throw new SysBusinessException(SysBusinessCode.DICTIONARY_CODE_NOT_EXIST);
        }
    }

    public static void updateValidate(SysDictionary sysDictionary) {
        if (StringUtils.isEmpty(sysDictionary.getId())) {
            throw new SysBusinessException(SysBusinessCode.ID_NOT_EXIST);
        }
    }
}
